<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">

    <script>
        // 需求: 10个input复选框, 默认上来都选中
        // 1. 准备标签
        // 2. 获取标签
        let inputList = document.querySelectorAll('input')
        // 3. 遍历每个input标签对象
        for (let i = 0; i < inputList.length; i++) {
            // 4. 设置checked状态
            inputList[i].checked = true
        }
    </script>
</body>
</html>